package Entity;

import java.sql.ResultSet;

import Control.MySQLController;

public class Workshop_BookingStatusCode {
	//Attributes
	String bookingStatusCode;
	String description;
	
	//Getters and Setters
	public String getBookingStatusCode() {
		return bookingStatusCode;
	}
	public void setBookingStatusCode(String bookingStatusCode) {
		this.bookingStatusCode = bookingStatusCode;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	
	//Constructors
	public Workshop_BookingStatusCode(){};
	
	public Workshop_BookingStatusCode(String bookingStatusCode){
		this.bookingStatusCode = bookingStatusCode;
	}
	
	public Workshop_BookingStatusCode(String bookingStatusCode, String description){
		this.bookingStatusCode = bookingStatusCode;
		this.description = description;
	}
	
	///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	
	public boolean retrieveBookingStatus(){
		boolean success = false;
		ResultSet rs = null;
		MySQLController db = new MySQLController();
		db.getConnection();
		String sql = "SELECT * FROM ooadpj.booking_status WHERE booking_status_code = '" + bookingStatusCode + "'";
		rs = db.readRequest(sql);
		try{
			while(rs.next()){
				description = rs.getString("description");
			}
		}
		catch(Exception e){
			e.printStackTrace();
		}
		finally{
			db.terminate();
		}
		return success;
	}
}
